//
//  AARotationExecutor.m
//  AnimAPI
//
//  Created by Alécio José Gomes Neto on 07/03/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "AARotationExecutor.h"

@implementation AARotationExecutor

-(void) execute{
	CAKeyframeAnimation *rotation = [CAKeyframeAnimation animation];

	rotation.values = [NSArray arrayWithObjects:
					   [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0.0f, 0.0f, 1.0f, 0.0f)],
					   [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f)],
					   [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI * 2, 0.0f, 1.0f, 0.0f)], nil];
	
	rotation.duration = animation.animationTime;
	rotation.delegate = view;
	
	[[view layer] addAnimation:rotation forKey:@"transform"];
}

@end
